package com.lupan.mutithred.cp4_Executor;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 说明：
 *
 * @author lupan
 * @version 2017/4/26 14:25
 */
public class Main {

    public static void main(String[] args) {

        Runnable runnable = () -> {
            System.out.println("任务执行完成。。。");
            int i = 2/0;
        };

        ThreadPoolExecutor pool = new ThreadPoolExecutor(2,10,5, TimeUnit.SECONDS,new LinkedBlockingQueue<>());
        pool.setThreadFactory(new MyThreadFactory());

        pool.execute(runnable);
    }
}
